package com.lyf.service;

import java.util.List;

import com.lyf.dao.EmployeeDao;
import com.lyf.pojo.Employee;

public class EmployeeService {

	private EmployeeDao dao;
	
	public Employee login(Employee employee){
		Employee e = dao.findByUnique("username", employee.getUsername());
		if(e != null && e.getPassword().equals(employee.getPassword())){
			return e;
		}
		return null;
	}


	public List<Employee> findAll(){
		return dao.findAll();
	}
	
	public Employee findByName(String username){
		return dao.findByUnique("username", username);
	}
	
	public void saveOrUpdate(Employee e){
		dao.saveOrUpdate(e);
	}

	
	//set,
	public void setDao(EmployeeDao dao) {
		this.dao = dao;
	}
	
	
}
